home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 3935 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.2 KB

  1. Path: mail2news.demon.co.uk!hpl3sn03.cern.ch
  2. From: Dan Pop <danpop@mail.cern.ch>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: What's wrong here?
  5. Date: Thu, 1 Feb 1996 02:44:06 +0100
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <9602010144.AA23637@dxmint.cern.ch>
  8. References: <4eml5o$o6h@airdmhor.gen.nz> <310FB5FF.4BE6@microsports.com>
  9. X-NNTP-Posting-Host: hpl3sn03.cern.ch
  10. X-Newsreader: NN version 6.5.0 #7 (NOV)
  11. X-Mail2News-Path: dxmint.cern.ch!hpl3sn03.cern.ch
  12.  
  13. >>   Watcom gives the following warnings (and _only_ those warnings) compiling
  14. >> the above code (except without the line numbers or colons), but only when
  15. >> it's compiling it as C++ and generating 32 bit code (GCC doesn't, no matter
  16. >> how hard I try).  I don't know C++ myself, but my flatmate is learning it,
  17. >> does it have anything to do with the typedef?
  18. >> 
  19. >> TEST.CPP(12): Warning! W389: (col 15) integral value may be truncated during
  20. >>               assignment or initialization
  21. >> TEST.CPP(17): Warning! W389: (col 15) integral value may be truncated during
  22. >>               assignment or initialization
  23. >
  24. >The typedef doesn't matter. 
  25.  
  26. This is the only sensible statement I could find.
  27.  
  28. >Try turning off the optimizer (-od). Lines 
  29.  
  30. Why?  How can the optimizer be responsible for these spurious warnings?
  31.  
  32. >12 is where a, b, c are first used and the uncasted numeric constants 
  33. >are being resolved. 
  34.  
  35. Plain nonsense.  Constants are _never_ "resolved".  The line 12 involves
  36. only variables.  
  37.  
  38. >Again, at line 17, d is being access (not 
  39. >assigned?!?) for the first time.
  40.  
  41. Are you blind, idiot or what?  The relevant portion of the code looks like
  42. this:
  43.  
  44.    9:     a = 1;
  45.   10:     b = 2;
  46.   11:     c = 4;
  47.   12:     d = a | b | c;
  48.   13: 
  49.   14:     d |= a;
  50.   15: 
  51.   16:     d |= a | b;
  52.   17:     d = d | a | b;
  53.  
  54. d is assigned for the first time at line 12 and its value is accessed for
  55. the first time at line 14, then at line 16.
  56.  
  57. >You may be able to clear everything up by changing lines 9-11 to:
  58. >  a = (word) 1;
  59. >  b = (word) 2;
  60. >  c = (word) 3;
  61.  
  62. More blatant nonsense.  How are these casts supposed to make _any_
  63. difference in the way the compiler handles lines 12 and 17???
  64.  
  65. Dan
  66. -- 
  67. Dan Pop
  68. CERN, CN Division
  69. Email: danpop@mail.cern.ch 
  70. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  71.